The abstraction provided by p4 for managing data in shared memory is monitors. Good places to learn about the monitor concept in general are [#!pbh:architecture!#] and [#!hoare:monitors!#]. The specific approach taken by p4 is described in [#!lusk-overbeek:p4-book!#]. P4 provides several useful monitors (p4_barrier_t, p4_getsub_monitor_t, p4_askfor_monitor_t) as well as a general monitor type to help the user in constructing his own monitors (p4_monitor_t).
Monitor-Building Primitives,Some Useful Monitors,Shared Memory Data Types,Functions for Shared Memory